<%@ page contentType="text/html; charset=utf-8"%>
<%@ page import="cn.agiledata.bank.common.util.Constant"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ipb" uri="/WEB-INF/conf/tld/ipb.tld"%>
<%@ taglib prefix="ad" uri="agiledata"%>
<%@ page import="cn.agiledata.bank.common.util.Constant"%>
<%@ page import="cn.agiledata.bank.account.service.IAccountConst"%>
<%@ page import="cn.agiledata.bank.account.service.AccountSummary"%>
<%
	String path = request.getContextPath();
	AccountSummary user = (AccountSummary) session
			.getAttribute(Constant.SESSION_ACCOUNT_SUMMARY);
%>
<link href="<%=path%>/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/newstyle.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/common.css" rel="stylesheet" type="text/css" />
<Style>
<!--
.box {width:100%;margin:auto;}
.off {margin-left:3px;line-height:34px;float:left;width:93px;height:34px;color:#0099CC;font-size:14px;font-weight:bold;text-align:center;background-color:#DCDEDD;cursor: hand;}
.on {margin-left:3px;line-height:34px;float:left;width:93px;height:34px;color:#0099CC;font-size:14px;font-weight:bold;text-align:center;border-top: 1px #CCCCCC solid;border-left:1px #CCCCCC solid;border-right: 1px #CCCCCC solid;cursor: hand;}
-->
</style>
<script type='text/javascript' src='<%=path%>/dwr/util.js'></script>
<script type='text/javascript' src='<%=path%>/js/ufront.js'></script>
<script type='text/javascript' src='<%=path%>/dwr/engine.js'></script>
<script language=javascript src="<%=path%>/js/vnv/commonForManage.js"></script>
<script language=javascript src="<%=path%>/js/popcalendar.js"></script>
<script type='text/javascript'
	src='<%=path%>/dwr/interface/accountTemplate.js'></script>
<script type='text/javascript' src='<%=path%>/js/vnv/commonForManage.js'></script>
<script language="JavaScript" type="text/JavaScript">
function validate(){
    var amountMin = document.forms[0].amountMin;
    var amountMax = document.forms[0].amountMax;
    if(parseFloat(amountMin.value)>parseFloat(amountMax.value)){
        alert("您输入的最小金额大于最大金额！");
        return false;
    }
    if(isNaN(amountMin.value)){
        alert('您输入的最小金额不正确，请重新输入');
        amountMin.value = "";
        amountMin.focus();
        return false;
    }
    if(isNaN(amountMax.value)){
        alert('您输入的最大金额不正确，请重新输入');
        amountMax.value = "";
        amountMax.focus();
        return false;
    }
    return true;
}
function doSubmit(){
    if(validate()){
        document.forms[0].submit();
    }
}
function getActionByTransStatus(transStatus){
    var action = "toWaitPay";
    if(transStatus=="1"){
        action = "waitingAuditList";
    }else if(transStatus=="2"){
        action = "waitingPayList";
    }else if(transStatus=="4"){
        action = "auditRejectList";
    }
    return "<%=path%>/page/transaction/"+action+".do";
}
function changeBatchType(batchType){
    if(validate()){
        var transStatus = document.forms[0].transStatus.value;
        document.forms[0].action = getActionByTransStatus(transStatus);
        document.forms[0].batchType.value = batchType+"";
        document.forms[0].submit();
    }
}
</script>
<div id="main">
	<div class="content_right">
		<div style="width:745px;margin-left:10px;">
			<div class="titleinfo">
				<logic:notEmpty name="transStatus">
					<%
								if (IAccountConst.COMPANY_TYPE_GATEWAY
								.equals(user.getCompanyType())) {
					%>退款确认<%
					} else {
					%>
					<ad:TypeChange typeId="ES_PRE_PAY_TRANS_STATUS">
						<bean:write name="transStatus" />
					</ad:TypeChange>单笔交易<%
					}
					%>
				</logic:notEmpty>
			</div>
			<%
						if (!IAccountConst.COMPANY_TYPE_GATEWAY.equals(user
						.getCompanyType())) {
			%>
			<div class="tab">
				<div class="on">
					单笔交易
				</div>
				<div class="off" onClick="changeBatchType(true)">
					批量交易
				</div>
			</div>
			<div class="drop_bg"></div>
			<%
			}
			%>
			<div class="edit_pass">
				<html:form action="toWaitPay">
					<html:hidden property="transStatus" />
					<html:hidden property="batchType" />
					<input type="hidden" name="viewBatchNo" value="" />
					<table width="100%" border="0" align="center" cellpadding="3"
						cellspacing="1">
						<tr>
							<td align="right" bgcolor="#FFFFFF" width="10%">
								交易编号：
								<br />
							</td>
							<td bgcolor="#FFFFFF">
								<html:text styleClass="inputStyle" property="transId" size="15" />
							</td>
							<td align="right" bgcolor="#FFFFFF" width="16%">
								<span class="qzt">请选择账户名称：</span>
							</td>
							<td bgcolor="#FFFFFF">
								<div class="select">
									<div>
										<html:select style="width:125px" property="subAccountID">
											<html:option value="">所有账户</html:option>
											<html:optionsCollection name="subList" label="accountName"
												value="id" />
										</html:select>
									</div>
								</div>
							</td>
							<%
										if (!IAccountConst.COMPANY_TYPE_GATEWAY.equals(user
										.getCompanyType())) {
							%>
							<td width="18%" align="right" bgcolor="#FFFFFF" width="10%">
								请选择交易类型：
							</td>
							<td width="30%" bgcolor="#FFFFFF">
								<div class="select">
									<div>
										<html:select property="actionTypeID">
											<html:option value="">全部</html:option>
											<html:optionsCollection name="actionTypeList"
												label="actionName" value="id" />
										</html:select>
									</div>
								</div>
							</td>
							<%
							} else {
							%>
							<td width="17%" bgcolor="#FFFFFF"></td>
							<td width="33%" bgcolor="#FFFFFF">
								<html:hidden property="actionTypeID" />
							</td>
							<%
							}
							%>
						</tr>
						<tr>
							<td align="right" bgcolor="#FFFFFF" >
								交易日期：
							</td>
							<td bgcolor="#FFFFFF" colspan="2">
								<span class="qzt"><ad:calendar property="strBeginDate"
										path="<%=path%>" /> </span> 至
								<span class="qzt"><ad:calendar property="strEndDate"
										path="<%=path%>" /> </span>
							</td>
							<td align="right" bgcolor="#FFFFFF">
								<span class="qzt">交易金额</span>：
							</td>
							<td bgcolor="#FFFFFF" colspan="2">
								<span class="qzt"> <html:text styleClass="inputStyle"
										size="10" property="amountMin" onkeyup="id_keyup(this)" /></span> 至
									<span class="qzt"><html:text styleClass="inputStyle"
											size="10" property="amountMax" onkeyup="id_keyup(this)" /> </span>
							</td>
						</tr>
						<tr>
							<td colspan="6" align="right" bgcolor="#FFFFFF">
								<hr size="1" style="color:#88A7C0;" />
							</td>
						</tr>
						<tr>
							<td colspan="6" align="center" bgcolor="#FFFFFF">
								<span class="button_Frame"> <input name="button"
										type="button" class="graybutton_style" onclick="doSubmit()"
										value="查 询" /> </span>
							</td>
						</tr>
					</table>
					<br />
					<table width="100%" class="tablestyle">
						<tr>
							<th>
								<span class="blue14">交易编号</span>
							</th>
							<th>
								<span class="blue14">交易子账户</span>
							</th>
							<th>
								<span class="blue14">交易对方</span>
							</th>
							<th>
								<span class="blue14">交易类型</span>
							</th>
							<th>
								<span class="blue14">交易时间</span>
							</th>
							<th>
								<span class="blue14">金额</span>
							</th>
							<logic:notEmpty name="transStatus">
								<th>
									<span class="blue14">操作</span>
								</th>
								<logic:equal name="transStatus"
									value="<%=Constant.ES_TRANS_STATUS_UNPAY%>">
									<!-- 待支付状态 -->
									<th>
										<span class="blue14">取消</span>
									</th>
								</logic:equal>
								<logic:equal name="transStatus"
									value="<%=Constant.ES_TRANS_STATUS_REJECTED%>">
									<!-- 审核拒绝状态，点取消可以取消此交易申请 -->
									<th>
										<span class="blue14">取消</span>
									</th>
								</logic:equal>
							</logic:notEmpty>
						</tr>
						<c:forEach var="id" items="${waitPayList.data}" varStatus="status">
							<tr align="center">
								<td>
									<logic:notEmpty name="transStatus">
										<a class="menuTextBlue"
											href="<%=path%>/page/transaction/esPerPayTransPayDetail.do?transactionID=<bean:write name="id" property="id"/>">
											<bean:write name="id" property="transId" /> </a>
									</logic:notEmpty>
								</td>
								<td>
									<bean:write name="id" property="debit.accountName" />
								</td>
								<td>
									<logic:equal name="id" property="actionType.id" value="3">
										<a class="menuTextBlue"
											href="<%=path%>/page/common/getAccount.do?accountId=<bean:write name="id" property="credit.account.id"/>">
											<bean:write name="id" property="creditName" /> </a>
									</logic:equal>
									<logic:notEqual name="id" property="actionType.id" value="3">
										<bean:write name="id" property="credit.account.name" />
									</logic:notEqual>
								</td>
								<td>
									<bean:write name="id" property="actionType.actionName" />
								</td>
								<td>
									<bean:write name="id" property="updateTime"
										format="yyyy-MM-dd HH:mm:ss" />
								</td>
								<td>
									<bean:write name="id" property="amount" format="#0.00" />
								</td>
								<logic:notEmpty name="transStatus">
									<td>
										<logic:equal name="id" property="transStatus"
											value="<%=Constant.ES_TRANS_STATUS_UNPAY%>">
											<!-- 待支付状态 -->
											<a class="menuTextBlue"
												href="<%=path%>/page/transaction/esPerPayTransPayDetail.do?type=1&transactionID=<bean:write name="id" property="id"/>">
												<logic:equal name="id" property="actionType.id"
													value="<%=Constant.ACTION_TYPE_R%>">
			  退款
			  </logic:equal> <logic:notEqual name="id" property="actionType.id"
													value="<%=Constant.ACTION_TYPE_R%>">
			  支付
			  </logic:notEqual> </a>
										</logic:equal>
										<logic:equal name="id" property="transStatus"
											value="<%=Constant.ES_TRANS_STATUS_REJECTED%>">
											<!-- 审核拒绝状态，点操作可以提交重审 -->
											<logic:notEqual name="id" property="actionType.id"
												value="<%=Constant.ACTION_TYPE_R%>">
												<!-- 退款不可以进行提交重审 -->
												<a class="menuTextBlue"
													href="<%=path%>/page/transaction/esPerPayTransPayDetail.do?type=1&transactionID=<bean:write name="id" property="id"/>">操作</a>
											</logic:notEqual>
										</logic:equal>

										<logic:equal name="id" property="transStatus"
											value="<%=Constant.ES_TRANS_STATUS_UNAUDIT%>">
											<!-- 待审核状态 -->
											<a class="menuTextBlue"
												href="<%=path%>/page/transaction/esPerPayTransPayDetail.do?type=1&transactionID=<bean:write name="id" property="id"/>">审核</a>
										</logic:equal>
										<logic:equal name="transStatus"
											value="<%=Constant.ES_TRANS_STATUS_UNPAY%>">
											<!-- 待支付状态 -->
											<td align="center">
												<a class="menuTextBlue" href="#"
													onclick="if (confirm('您确定要取消此交易吗？')) location.href='<%=path%>/page/transaction/esPerPayTransPayDel.do?batchType=false&transactionID=<bean:write name="id" property="id"/>&oldStatus=<%=Constant.ES_TRANS_STATUS_UNPAY%>';">取消</a>
											</td>
										</logic:equal>
										<logic:equal name="transStatus"
											value="<%=Constant.ES_TRANS_STATUS_REJECTED%>">
											<!-- 审核拒绝状态，点取消可以取消此交易申请 -->
											<td align="center">
												<a class="menuTextBlue" href="#"
													onclick="if (confirm('您确定要取消此交易吗？')) location.href='<%=path%>/page/transaction/esPerPayTransPayDel.do?batchType=false&transactionID=<bean:write name="id" property="id"/>&oldStatus=<%=Constant.ES_TRANS_STATUS_REJECTED%>';">取消</a>
											</td>
										</logic:equal>
									</td>
								</logic:notEmpty>
							</tr>
						</c:forEach>
					</table>
					<table width="100%" height="30" border="0" cellpadding="0"
						cellspacing="0">
						<tr>
							<td height="25" align="center" class="font_blue">
								<ad:PageBean name="waitPayList" />
							</td>
						</tr>
					</table>
				</html:form>
			</div>
		</div>
	</div>
</div>
